﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;

namespace ZRT.RHPX.Core.User
{
    [Serializable]
    public class UserIdentity : IIdentity
    {
        #region 新加属性
        /// <summary>
        /// 当前登录用户的数据
        /// </summary>
        public UserEntity CurretnUser { get; set; }

        #endregion 属性

        #region 构造函数
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="Entity"></param>
        public UserIdentity(UserEntity Entity)
        {
            this.CurretnUser = Entity;
        }
        #endregion 

        #region 原有属性

        public string AuthenticationType
        {
            get
            {
                return "Custom Authentication";
            }
        }

        public bool IsAuthenticated
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// 用户名
        /// </summary>
        public string Name
        {
            get
            {
                if (CurretnUser != null)
                    return CurretnUser.UserName;
                else
                    return string.Empty;
            }
        }

        #endregion 
    }
}
